<?php

namespace Controller\Index;

class Index extends \Controller\Base {

    public function actionIndex() {
        $advertisingClass = \Data\Advertising::instance();
        $Pid = \Data\Category::instance()->getCategoryIdByCategoryName('新闻中心');
        $categoryIds = \Data\Category::instance()->getCategoryByPid($Pid);
        $ids = array();
        foreach($categoryIds as $val) {
            $ids[] = $val['CategoryId'];
        }
        $homeLeft = \Data\Advertising::HOMELEFT;
        $homeRight = \Data\Advertising::HOMERIGHT;
        $homeLeftAdvertising = $advertisingClass->getAdvertisingByType($homeLeft,3);
        $homeRightAdvertising = $advertisingClass->getAdvertisingByType($homeRight, 3);
        $journalism = \Data\Article::instance()->getAllArticleByCategoryIds($ids, 3);
        $notice = \Data\Article::instance()->getAllArticleByCategoryIds(array(15), 3);
        $this->assign('homeLeftAdvertising', $homeLeftAdvertising);
        $this->assign('homeRightAdvertising', $homeRightAdvertising);
        $this->assign('journalism', $journalism);
        $this->assign('notice', $notice);
        $this->setMeta('首页');
        $this->display();
    }
}